package com.css.bjdt_core.executive.entity;

import com.css.bjdt_core.report.entity.RptTemplateCalc;
import com.css.bjdt_core.report.entity.RptTemplateCalc.CalcType;
import com.css.bjdt_core.report.entity.RptTemplateValidation;
import com.css.bjdt_core.report.entity.RptTemplateValidation.ValidationType;

import lombok.Data;

@Data
public class Exp {
	//表达式
	private String formula;
	//表达式前台展示
	private String formulaShow;
	//单元格表达式
	private String cellExp;
	//表达式类型
	private String formulaType;

	private String formulaComment;
	//排序
	private Integer order;

	//是否关联报表说明
	private String isRelationExplain;

	//关联的报表说明
	private String relationExplainId;

	public Exp() {
	}

	public Exp(RptTemplateCalc calc) {
		formula = calc.getCalcFormula();
		formulaShow = calc.getCalcFormulaShow();
		formulaType = calc.getCalcType();
		order = calc.getOrderId();
		if (CalcType.cell.getKey().equals(formulaType)) {
			cellExp = calc.getCalcFormula();
		}
	}

	public Exp(RptTemplateValidation validation) {
		formula = validation.getValidationFormula();
		formulaShow = validation.getValidationFormulaShow();
		formulaType = validation.getValidationType();
		formulaComment = validation.getValidationFormulaComment();
		isRelationExplain = validation.getIsRelationExplain();
		relationExplainId = validation.getRelationExplainId();
		if (ValidationType.inner_cell.getKey().equals(formulaType)
				|| ValidationType.outer_cell.getKey().equals(formulaType)) {
			cellExp = validation.getValidationFormula();
		}
	}
}
